SUBROUTINE TAG_ATTR
     * Create a simple table using RWS_TAG and RWA_TAG_ATTR.

     * Include the RealWeb definitions.
     INCLUDE #RW.INCLUDE.DEFS FROM /SYSFILES/REALWEB,BP

     EQU AM TO CHAR(254)

     * Start the HTML page.
     CALL RW_START_HTML_PAGE("Table Example using RWA_TAG_ATTR", "", "", "", "")

     * Initialise the HTML string buffer.
     HTML = ""

     * Create a caption for the table.
     TEXT = "Areas giving rise to faults in software"
     CALL RWS_TAG(TEXT, "caption", "")
     HTML = HTML : TEXT

     * Assemble some data to go in the table.
     ROW = ""
     *    Tags.
     TAGS = "th":AM:"th"
     *    Headings.
     DATA = "Phase giving rise to fault":AM:"Percentage of total faults"
     * Tag the data as heading cells.
     CALL RWA_TAG_ATTR(ROW, TAGS, DATA, 1, "")
     * Tag the text as a table row.
     CALL RWS_TAG(ROW, "tr", "")
     HTML = HTML : ROW

     *    Tags.
     TAGS = "td":AM:"td"

     * Data.
     ROW = ""
     DATA = "Requirements definition":AM:"38"
     * Tag the data as table cells.
     CALL RWA_TAG_ATTR(ROW, TAGS, DATA, 1, "")
     CALL RWA_TAG(HTML, "tr", ROW, "")

     ROW = ""
     DATA = "Maintenance (operation)":AM:"32"
     CALL RWA_TAG_ATTR(ROW, TAGS, DATA, 1, "")
     CALL RWA_TAG(HTML, "tr", ROW, "")

     ROW = ""
     DATA = "Design":AM:"23"
     CALL RWA_TAG_ATTR(ROW, TAGS, DATA, 1, "")
     CALL RWA_TAG(HTML, "tr", ROW, "")

     ROW = ""
     DATA = "Installation":AM:"7"
     CALL RWA_TAG_ATTR(ROW, TAGS, DATA, 1, "")
     CALL RWA_TAG(HTML, "tr", ROW, "")

     * Create the table.
     aClass = ""
     aClass<2> = "border=border"
     CALL RWS_TAG(HTML, "table", aClass)

     * Output the HTML.
     CALL RW_PUT(HTML)

     * Complete the page.
     CALL RW_END_PAGE
RETURN

Go to top button